email me at borlaj@portlandschools.org

Loading
notes previous (12/<12) submit the dump links  
 

Sound in JFrames

 

 

Just go here oo

 

 

 

 

 

 

 

 

 

 

BELOW IS UNNECESSARY

 

 

To add sound to JFrame, keep your code about sound from here.

Now add the following imports:

            import sun.audio.*;
			import java.io.File;
            import java.applet.*;
            
And put these methods in (note comment them out when you switch it to a JApplet)
               
	public AudioClip getAudioClip(boolean nothing, String fileName)
    {
        AudioClip returnClip=null;
        File file = new File(fileName);

        try {
            returnClip = JApplet.newAudioClip(file.toURL());

        } catch (Exception e) {
            e.getMessage();
        }
        return returnClip;
    }
    public boolean getCodeBase(){
        return false;
    }